home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / dos / adddosentry.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  92 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: adddosentry.c,v 1.5 1996/10/24 15:50:23 aros Exp $
  4.     $Log: adddosentry.c,v $
  5.     Revision 1.5  1996/10/24 15:50:23  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.4  1996/10/10 13:18:38  digulla
  9.     Use dl_DevNam instaed of dl_Name (STRPTR and BPTR) (Fleischer)
  10.  
  11.     Revision 1.3  1996/08/13 13:52:44  digulla
  12.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  13.     Replaced AROS_LA by AROS_LHA
  14.  
  15.     Revision 1.2  1996/08/01 17:40:47  digulla
  16.     Added standard header for all files
  17.  
  18.     Desc:
  19.     Lang: english
  20. */
  21. #include <dos/dosextens.h>
  22. #include <clib/utility_protos.h>
  23.  
  24. /*****************************************************************************
  25.  
  26.     NAME */
  27.     #include <clib/dos_protos.h>
  28.  
  29.     AROS_LH1(LONG, AddDosEntry,
  30.  
  31. /*  SYNOPSIS */
  32.     AROS_LHA(struct DosList *, dlist, D1),
  33.  
  34. /*  LOCATION */
  35.     struct DosLibrary *, DOSBase, 113, Dos)
  36.  
  37. /*  FUNCTION
  38.     Adds a given dos list entry to the dos list. Automatically
  39.     locks the list for writing. There may be not more than one device
  40.     or assign node of the same name. There are no restrictions on
  41.     volume nodes.
  42.  
  43.     INPUTS
  44.     dlist - pointer to dos list entry.
  45.  
  46.     RESULT
  47.     !=0 if all went well, 0 otherwise.
  48.  
  49.     NOTES
  50.     Since anybody who wants to use a device or volume node in the
  51.     dos list has to lock the list, filesystems may be called with
  52.     the dos list locked. So if you want to add a dos list entry
  53.     out of a filesystem don't just wait on the lock but serve all
  54.     incoming requests until the dos list is free instead.
  55.  
  56.     EXAMPLE
  57.  
  58.     BUGS
  59.  
  60.     SEE ALSO
  61.  
  62.     INTERNALS
  63.  
  64.     HISTORY
  65.     29-10-95    digulla automatically created from
  66.                 dos_lib.fd and clib/dos_protos.h
  67.  
  68. *****************************************************************************/
  69. {
  70.     AROS_LIBFUNC_INIT
  71.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  72.     LONG success=1;
  73.     struct DosList *dl;
  74.  
  75.     dl=LockDosList(LDF_ALL|LDF_WRITE);
  76.     if(dlist->dol_Type!=DLT_VOLUME)
  77.     {
  78.     dl=FindDosEntry(dl,dlist->dol_DevName,LDF_DEVICES|LDF_ASSIGNS|LDF_WRITE);
  79.     if(dl!=NULL)
  80.         success=0;
  81.     }
  82.     if(success)
  83.     {
  84.     dlist->dol_Next=DOSBase->dl_DevInfo;
  85.     DOSBase->dl_DevInfo=dlist;
  86.     }
  87.     UnLockDosList(LDF_ALL|LDF_WRITE);
  88.  
  89.     return success;    
  90.     AROS_LIBFUNC_EXIT
  91. } /* AddDosEntry */
  92.